package com.medusa.aps.business.model.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;

/**
 * @author miskw
 * @date 2023/8/30
 * @describe 描述
 */
@Getter
@Schema(description = "操作类型")
public enum OperateType {
    /**
     * 导入
     */
    @Schema(description = "导入")
    IMPORT(0, "导入"),
    /**
     * 导出
     */
    @Schema(description = "导出")
    EXPORT(1, "导出");
    @EnumValue
    private final int value;
    private final String desc;

    OperateType(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static String getDescByValue(int value) {
        for (OperateType operateType : OperateType.values()) {
            if (operateType.value == value) {
                return operateType.desc;
            }
        }
        return null;
    }

    public static OperateType getEnumByValue(int value) {
        for (OperateType operateType : OperateType.values()) {
            if (operateType.value == value) {
                return operateType;
            }
        }
        return null;
    }


}
